﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Collections;

namespace Silvermoon.Controls
{
    /// <summary>
    /// Interface for all controls which host <see cref="Item"/>s.
    /// </summary>
    public interface IItemHost
    {

        /// <summary>
        /// Gets or sets the selected item index, otherwise -1.
        /// </summary>
        int SelectedItemIndex { get; set; }

        /// <summary>
        /// Specifies whether the host supports individual height for each item.
        /// </summary>
        bool IsDynamicItemHeightSupported { get; }

        /// <summary>
        /// Sets the height for a specific item.
        /// </summary>
        /// <param name="index">Index of the item.</param>
        /// <param name="height">Height of the item.</param>
        void SetItemHeight(int index, int height);

        /// <summary>
        /// Occurs when an item is tapped.
        /// </summary>
        /// <param name="item"></param>
        void OnTapItem(Item item);

        /// <summary>
        /// Brings an item into view.
        /// </summary>
        /// <param name="itemIndex">Index of the item.</param>
        /// <param name="animated">True for animation, otherwise false.</param>
        void BringItemIntoView(int itemIndex, bool animated);

        /// <summary>
        /// Brings a rectangle within an item into view.
        /// </summary>
        /// <param name="itemIndex">Index of the item.</param>
        /// <param name="rect">Rectangle within the item to bring into view.</param>
        /// <param name="animated">True for animation, otherwise false.</param>
        void BringItemRectIntoView(int itemIndex, Rectangle rect, bool animated);

        /// <summary>
        /// Gets whether an item is selected.
        /// </summary>
        /// <param name="item">Item to test.</param>
        /// <returns>true, if the item is selected, otherwise false.</returns>
        bool IsItemSelected(Item item);

        /// <summary>
        /// Invalidates the host.
        /// </summary>
        /// <param name="flags">Flags for invalidation.</param>
        void Invalidate(InvalidationFlag flags);

        /// <summary>
        /// Gets the currently realized and attached item in the host, otherwise null.
        /// </summary>
        /// <param name="index">Index of the item.</param>
        /// <returns>Item in the host, if attached, otherwise false.</returns>
        Item GetRealizedItem(int index);

        /// <summary>
        /// Gets the collection that contains objects to virtualize.
        /// </summary>
        IList ItemsSource { get; }

    }
}
